package com.ruoyi.common.entity;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.Data;

import java.io.Serializable;
import java.time.LocalDate;
import java.time.LocalDateTime;

@Data
@TableName("project_items") // 指定数据库表名
public class ProjectItem implements Serializable {

    @TableId(type = IdType.AUTO) // 主键自增
    @JsonSerialize(using = ToStringSerializer.class)
    private Long id;

    private Long projectId;

    private Long categoryId;

    private String title;

    private String description;

    private String iconClass;

    private Integer sortOrder; // 使用 Integer 以允许 null

    private String features;

    private Integer status;

    @TableField(fill = FieldFill.INSERT) // 插入时填充
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private LocalDate createTime;

    @TableField(fill = FieldFill.INSERT_UPDATE) // 插入和更新时填充
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private LocalDate updateTime;

    @TableField(fill = FieldFill.INSERT)
    private String createBy;

    @TableField(fill = FieldFill.INSERT_UPDATE)
    private String updateBy;
    @TableField(exist = false)
    private String categoryTitle;


}